package com.cy.personer.web.userWeb;

import com.cy.personer.bean.Report;
import com.cy.personer.bean.User;
import com.cy.personer.mapper.ReportSxbMapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.List;
@Controller
@RequestMapping("/frontReport")
public class FrontReport {
    @Resource
    ReportSxbMapper reportSxbMapperImpl;
    //门户上根据userId显示所有报告
    @RequestMapping("/findUserReport.action")
    public String findUserReport(HttpServletRequest request, Integer num){
        if(num==null||num==0){
            num=1;
        }
        HttpSession session = request.getSession();
        User user = (User)session.getAttribute("user");
        PageHelper.startPage(num,10);
        List<Report> reports = reportSxbMapperImpl.userReports(user);
        PageInfo<Report> page = new PageInfo<>(reports);
        request.setAttribute("page",page);
        return "user/report_list";
    }




}
